# -*- coding = utf-8 -*-
# @Time    : 2025/3/31 下午8:48
# @Author  : yqk
# @File    : 防止检测3.py
# @Software: PyCharm
import undetected_chromedriver as uc


def run():
    opt = uc.ChromeOptions()
    opt.headless = True
    # 添加更多反检测选项
    opt.add_argument("--disable-blink-features=AutomationControlled")
    opt.add_argument("--disable-infobars")

    browser = uc.Chrome(options=opt)
    try:
        browser.get('https://www.taobao.com/')
        title = browser.title
        print(title)
    except Exception as e:
        print(f"发生错误: {e}")
    finally:
        browser.quit()


if __name__ == "__main__":
    run()